#include "map.h"
#include "piece.h"
#include "game.h"

//http://en.wikipedia.org/wiki/Chess
//i used this to look at where the piece go, i forgot

int main(int argc, char ** argv)
{
	int input = 0;
	Game g;
	time_t now, then = clock(), passed, soon;
	
	g.init();

	while(g.isRunning())
	{
		now = clock();

		// draw
		g.draw();

		// throttle code
		soon = clock() + 1000;
		while(clock() < soon && !_kbhit()){Sleep(1);}
		
		// input
		if(_kbhit())
		{
			input = _getch();
			g.handleInput(input);
		}
		// update
		passed = now - then;
		then = now;
		g.update(passed);
	}
	return 0;
}